<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core">

<ui:composition template="/WEB-INF/templates/BasicTemplate.xhtml">

	<ui:define name="content">
		<c:set target="#{userBean}" property="action" value="MANAGE_USERS" />
		<h:form rendered="#{userBean.permissions}">
			<h:dataTable value="#{userBean.users}" var="user" bgcolor="#F1F1F1"
				border="2" width="60%">
				<h:column>
					<f:facet name="header">Login </f:facet>
					<h:outputText value="#{user.login}" />
				</h:column>

				<h:column>
					<f:facet name="header">Name</f:facet>
					<h:outputText value="#{user.name}" />
				</h:column>

				<h:column>
					<f:facet name="header">Surname</f:facet>
					<h:outputText value="#{user.sname}" />
				</h:column>

				<h:column>
					<f:facet name="header">Type</f:facet>
					<h:outputText value="#{user.type}" />
				</h:column>

				<h:column>
					<f:facet name="header"></f:facet>
					<h:commandButton value="Edit" action="#{userBean.redirect}">
						<f:setPropertyActionListener target="#{userBean.selectedUser}"
							value="#{user}" />
						<f:setPropertyActionListener target="#{userBean.page}"
							value="editUser.xhtml" />
					</h:commandButton>
				</h:column>

				<h:column>
					<h:commandButton value="Remove" action="#{userBean.redirect}">
						<f:setPropertyActionListener target="#{userBean.selectedUser}" value="#{user}" />
						<f:setPropertyActionListener target="#{userBean.page}" value="removeUser.xhtml" />
					</h:commandButton>
				</h:column>

			</h:dataTable>

		</h:form>
		<h:outputLabel value="You don't have permissions to this page"
			rendered="#{!userBean.permissions}" />
	</ui:define>

</ui:composition>
</html>